﻿using System;
using System.Collections.Generic;
using System.Linq.Expressions;

namespace Dapper.Library
{
    /// <summary>
    /// 一般操作上下文
    /// </summary>
    public class SetContext
    {
        public SetContext()
        {
            OrderbyList = new Dictionary<OrderByType, string>();
        }
        /// <summary>
        /// 表类型
        /// </summary>
        public Type TableType { get; internal set; }

        /// <summary>
        /// 条件表达式
        /// </summary>
        public LambdaExpression WhereExpression { get; internal set; }

        ///// <summary>
        ///// 条件表达式
        ///// </summary>
        //public List<LambdaExpression> WhereExpressionList { get; set; }

        /// <summary>
        /// 执行语句
        /// </summary>
        public string SqlString { get; internal set; }

        /// <summary>
        /// 条件语句对应的参数
        /// </summary>
        public object Params { get; internal set; }

        /// <summary>
        /// 不存在表达式
        /// </summary>
        public LambdaExpression IfNotExistsExpression { get; internal set; }

        /// <summary>
        /// 排序表达式
        /// </summary>
        public Dictionary<OrderByType, string> OrderbyList { get; internal set; }

        /// <summary>
        /// 查询表达式
        /// </summary>
        public LambdaExpression SelectExpression { get; internal set; }

        /// <summary>
        /// 前N条
        /// </summary>
        public int? TopNum { get; internal set; }

        /// <summary>
        /// 查询不需要加锁
        /// </summary>
        public bool NoLock { get; internal set; }
    }
}
